import java.time.LocalDateTime;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class TreadDemo7 {
    public static void main(String[] args) {
        ExecutorService service=Executors.newSingleThreadScheduledExecutor();
        System.out.println("添加任务时间:"+ LocalDateTime.now());
        service.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("执行任务："+LocalDateTime.now());
            }
        },2);
    }
}
